package com.star.comtroller;

import com.star.entry.Information;
import com.star.entry.User;
import com.star.pojo.InformationUser;
import com.star.service.impl.InformationServiceImpl;
import com.star.service.impl.UserServiceImpl;
import com.star.util.ResultObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@SuppressWarnings("all")
@RestController
@RequestMapping("/information/")
public class InformationController {
    @Autowired
    private InformationServiceImpl informationService;
    @Autowired
    private ResultObject result;
    @Autowired
    private UserServiceImpl userService;
    @RequestMapping("finish")
    public ResultObject add(InformationUser informationUser){
        boolean b = informationService.insert(informationUser);
        if(b){
            result.setStatus(400);
            result.setResult("填写成功");
        }else{
            result.setStatus(406);
            result.setResult("填写失败");
        }
        return result;
    }
    @RequestMapping("select")
    public ResultObject login(User user) {
        User user1 = userService.select(user);
        result.setStatus(400);
        result.setResult(user1);
        return result;
    }
    @RequestMapping("update")
    public ResultObject update(User user){
        boolean b = userService.update(user);
        if(b){
            result.setStatus(400);

        }else{
            result.setStatus(406);

        }
        return result;
    }
   /* User user1 = userService.selectForgot(user);
        result.setResult(user1);
        result.setStatus(400);
        return result;
*/

}
